package com.lanhu.designpattern.prototype.deep;

import java.util.ArrayList;
import java.util.List;

/**
 * author:zhangzg
 * date:2020/11/8 18:29
 */
public class Test {
    public static void main(String[] args) {
        List<String> arrayList = new ArrayList<>();
        arrayList.add("test");
        arrayList.add("test2");
        WordDocument wordDocument = new WordDocument("我是蓝狐", "蓝狐", arrayList);
        WordDocument clone1 = wordDocument.clone();
        WordDocument clone2 = wordDocument.clone();
        clone2.getDocument().add("test");

        System.out.println(clone1.getDocument().size() +":" + clone1.getDocument().hashCode());
        System.out.println(clone2.getDocument().size() +":" + clone2.getDocument().hashCode());
    }
}
